package com.ys.erp.stage_mall_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.stage_mall_service.bean.condition.HomeGroupAreaCondition;
import com.ys.erp.stage_mall_service.bean.vo.HomeGroupAreaInfoVO;
import com.ys.erp.stage_mall_service.bean.vo.HomeGroupAreaVO;
import com.ys.erp.stage_mall_service.service.HomeGroupAreaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author minamiyama
 * @date 2025/5/19 11:33
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/mall/HomeGroupArea/")
@Tag(name = "商品聚合区配置", description = "商品聚合区配置")
@ResponseResult
public class HomeGroupAreaController {
    private final HomeGroupAreaService homeGroupAreaService;


    @PostMapping("addOrUpdateHomeGroupArea")
    @CheckEmpLogin
    @Operation(summary = "添加商品配置聚合区")
    public void addOrUpdateHomeGroupArea(@RequestBody HomeGroupAreaCondition.AddOrUpdateHomeGroupAreaCon con, @StageLoginEmp StageEmpDTO empDTO) {
        homeGroupAreaService.addHomeGroupArea(con, empDTO);
    }

    @GetMapping("delHomeGroupArea")
    @CheckEmpLogin
    @Operation(summary = "删除商品配置聚合区")
    public void delHomeGroupArea(@RequestParam("id") Long id, @StageLoginEmp StageEmpDTO empDTO) {
        homeGroupAreaService.delHomeGroupArea(id, empDTO);
    }

    @GetMapping("updateHomeGroupAreaStatus")
    @CheckEmpLogin
    @Operation(summary = "更新商品配置聚合区状态")
    public void updateHomeGroupAreaStatus(@RequestParam Long id, @StageLoginEmp StageEmpDTO empDTO) {
        homeGroupAreaService.updateHomeGroupAreaStatus(id, empDTO);
    }

    @GetMapping("getHomeGroupArea")
    @CheckEmpLogin
    @Operation(summary = "获取商品配置聚合区列表")
    public List<HomeGroupAreaVO> getHomeGroupArea(@StageLoginEmp StageEmpDTO empDTO) {
        return homeGroupAreaService.getHomeGroupAreaList();
    }

    @GetMapping("getHomeGroupAreaInfo")
    @CheckEmpLogin
    @Operation(summary = "获取商品配置聚合区")
    public HomeGroupAreaInfoVO getHomeGroupAreaInfo(@RequestParam("id") Long id,@StageLoginEmp StageEmpDTO empDTO) {
        return homeGroupAreaService.getHomeGroupAreaInfo(id);
    }


}
